//
//  CellOfDidian.m
//  project-A (pianke)
//
//  Created by dllo on 16/2/28.
//  Copyright © 2016年 scott. All rights reserved.
//

#import "CellOfDidian.h"
#import "ModleOfgonglue.h"
#import <UIImageView+WebCache.h>
#import <DKNightVersion.h>
@interface CellOfDidian ()
@property (nonatomic, retain) UILabel *label_name_cn;
@property (nonatomic, retain) UILabel *label_name_en;
@property (nonatomic, retain) UILabel *label_add_count;
@property (nonatomic, retain) UIImageView *imgBack;

@end

@implementation CellOfDidian

-(void)dealloc{
    [_imgBack release];
    [_label_add_count release];
    [_label_name_cn release];
    [_label_name_en release];
    
    
    self.label_name_cn.dk_textColorPicker  = DKColorWithColors([UIColor whiteColor], [UIColor colorWithRed:0.16 green:0.14 blue:0.13 alpha:1]);
    self.label_name_en.dk_textColorPicker  = DKColorWithColors([UIColor whiteColor], [UIColor colorWithRed:0.16 green:0.14 blue:0.13 alpha:1]);
    self.label_add_count.dk_textColorPicker  = DKColorWithColors([UIColor whiteColor], [UIColor colorWithRed:0.16 green:0.14 blue:0.13 alpha:1]);

    
    [super dealloc];
    
}

- (void)passModel:(ModleOfgonglue *)model {
    self.label_name_cn.text = model.name_zh_cn;
    self.label_name_en.text = model.name_en;
    self.label_add_count.text =[NSString stringWithFormat:@"%@ 旅行地",model.poi_count];
    [self.imgBack sd_setImageWithURL:[NSURL URLWithString:model.image_url] placeholderImage:nil options:SDWebImageProgressiveDownload];
    
    
}


-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        [self creatView];
        
        
    }
    
    return self;
}

-(void)creatView{
    
    self.imgBack = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imgBack];
    
    self.label_name_cn = [[UILabel alloc] init];
    [self.contentView addSubview:self.label_name_cn];
     self.label_name_cn.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:30];
    self.label_name_cn.textColor = [UIColor whiteColor];
    
    
    self.label_name_en = [[UILabel alloc] init];
    [self.contentView addSubview:self.label_name_en];
    self.label_name_en.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:15];
    self.label_name_en.textColor = [UIColor whiteColor];
    
    
    self.label_add_count = [[UILabel alloc] init];
    self.label_add_count.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.label_add_count];
    self.label_add_count.font = [UIFont fontWithName:@"Verdana-Bold" size:15];
    self.label_add_count.textColor = [UIColor whiteColor];
    self.label_add_count.layer.masksToBounds = YES;
    
    self.label_add_count.layer.cornerRadius = 10;
    
    self.label_add_count.alpha = 0.8;
    
  
    
    [self.label_add_count release];
    [self.label_name_en release];
    [self.label_name_cn release];
    [self.imgBack release];

}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.imgBack.frame = self.contentView.bounds;
    self.label_name_cn.frame = CGRectMake(5, 5, 200, 40);
    self.label_name_en.frame = CGRectMake(5, 45, 200, 20);
    self.label_add_count.frame = CGRectMake(40, self.frame.size.height - 40, self.frame.size.width - 80, 20);
    self.label_add_count.backgroundColor = [UIColor blackColor];
    
    
}


@end
